#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_light_clicked()
{
    //设置窗体的背景色
    this->setStyleSheet("background-color:rgb(240,240,240)");
    //设置编辑框的背景色和字体颜色
    ui->plainTextEdit->setStyleSheet("background-color:white;color:black");
    //注意：一个控件只能设置依次styleSheet,第二次设置styleSheet会覆盖第一次的设置
    //ui->plainTextEdit->setStyleSheet("color:black");

    ui->pushButton_light->setStyleSheet("color:black");
    ui->pushButton_dark->setStyleSheet("color:black");

}

void Widget::on_pushButton_dark_clicked()
{
    //设置窗体的背景色
    this->setStyleSheet("background-color:black");
    //设置编辑框的背景色和字体颜色
    ui->plainTextEdit->setStyleSheet("background-color:black;color:white");
    //ui->plainTextEdit->setStyleSheet("color:white");

    ui->pushButton_light->setStyleSheet("color:white");
    ui->pushButton_dark->setStyleSheet("color:white");
}
